const mongoose = require('mongoose');
const Schema = mongoose.Schema;

const dateSchema = new Schema({
  date: {
    type: Date,
    unique: true
  }
},{toJSON: { virtuals: true }, toObject: { virtuals: true } });



// 虚拟关联文章（Date -> Node一对多关系）
dateSchema.virtual('nodes', {
  ref: 'Node',
  localField: '_id',
  foreignField: 'belong'
});


module.exports = mongoose.model('Date', dateSchema);